<template>
<div class="header">
  <div class="header-left">
    <div class="iconfont">&#xe624;</div>
  </div>
  <div class="header-input">
    <span class="iconfont">&#xe741;</span>
    <input type="text" placeholder="请输入城市/景点/游玩主题" />
  </div>
  <div class="header-right">
    <router-link to="city">
      {{this.city}}
      <span class="iconfont">&#xe6aa;</span>
    </router-link>
  </div>
</div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  name: 'HomeHeader',
  computed: {
    ...mapState(['city'])
  }
  // computed: mapState(['city'])  // 该方法和上面效果一样
}
</script>

<style scoped lang="stylus">
@import "~@/assets/style/var.styl"
.iconfont
  font-size:.36rem
  font-weight: bold;
.header
  display: flex
  line-height: 0.86rem
  background: $bgColor
  color: #fff
  .header-left
    width:.64rem
    float:left
    text-align:center
  .header-input
    flex: 1
    display:flex
    height:.62rem
    line-height:.62rem
    margin-top:.12rem
    margin-left: .2rem
    border-radius: .1rem
    background: #fff
    color: #e4e7ea
    padding: 0 .1rem;
    span
      width:.36rem
      float:left
    input
      float:left
      flex: 1
      height:.62rem
      line-height:.62rem
      color: #e4e7ea
  .header-right
    min-width:1.24rem
    float:right
    text-align: center
    a
      color:#fff
</style>
